package com.forecasting.testclass;

import java.util.ArrayList;
import java.util.Scanner;

import com.forecasting.model.PartNumber;
import com.forecasting.statistic.*;

public class testReaderNormal {

	public static void main(String[] args) {
		double fc = 0;
		double lt = 0;
		int rop = 0;
		double std = 0;
		
		ArrayList<Double> listsl =  new ArrayList<Double>();
		listsl.add(0.8);
		listsl.add(0.85);
		listsl.add(0.90);
		listsl.add(0.925);
		listsl.add(0.95);
		listsl.add(0.975);
		listsl.add(0.99);
		
		Scanner sc = new Scanner(System.in);
		boolean runprog = true;
		System.out.println("Service level and is ROP program");
		while (runprog){
			
			System.out.print("Enter forecast:");
			fc = sc.nextDouble();
			System.out.print("Enter leadtime:");
			lt = sc.nextDouble();
			System.out.print("Enter ROP:");
			rop = sc.nextInt();
			System.out.print("Enter Standard deviation:");
			std = sc.nextDouble();
			
			PartNumber pn1 = new PartNumber("333-444-0","Plates","Wings skin plates",lt,fc,rop,std);
			NormalDistribution nd1 = new NormalDistribution(pn1);

			//sl.calculateServiceLevel();
			System.out.print("Results:");
			//see serviceLevel method toString to understand prints
			System.out.print(nd1.toString());
			
			for( double sl : listsl){
				String res = sl * 100 + "%: " + nd1.getCalculatedROP(sl) +"; ";
				System.out.print(res);
			}
			System.out.println();
			
			System.out.println("Press c to continue or q to quit:");
			String temp = sc.next();
			if (temp.equals("q")){
				runprog = false;
			}
		}
		
		
	}

}
